package cn.lyjuan.aliyun.mq.conf.config;

import cn.lyjuan.aliyun.mq.conf.java.conf.producer.MQProducerImpl;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Configuration;

/**
 * Created by chad on 2016/11/9.
 */
@Configuration
public class DynamicPrepareConfigImpl extends ADynamicConfig
{
    @Override
    public Class<? extends MQProducerImpl> mqProducerClass()
    {
        return MQProducerPrepare.class;
    }

    public static class MQProducerPrepare extends MQProducerImpl
    {
        @Override
        public void prepare()
        {
            DynamicPrepareConfigImplTest.isPrepare = true;
        }
    }

    public DynamicPrepareConfigImpl(ConfigurableApplicationContext applicationContext,
                                    @Value(MQ_USER_CONF_EXPRESS) String mqUserConf)
    {
        super(applicationContext, mqUserConf);
    }

    @Override
    protected String getUniqueBaseName()
    {
        return "test";
    }
}
